/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.B670;
import queenb.web.inteface.B670Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class B670Store extends B670 implements B670Inf{

    @Override
    public List<B670> getListB670All(int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_B670, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, B670.class);
        } catch (SQLException ex) {
            Logger.getLogger(B670Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(B670Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(B670Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int updateB670(int pnPB670, String pvBV671, String pnBV672, int pnFH000, int pnFH200, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_B670, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPB670),
                    new Param(OracleTypes.CHAR, pvBV671),
                     new Param(OracleTypes.CHAR, pnBV672),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, B670.class);
        } catch (SQLException ex) {
            Logger.getLogger(B670Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    @Override
    public int deleteB670(int pnPB670, String pvLOGIN) {
         try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_B670, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPB670),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, B670.class);
        } catch (SQLException ex) {
            Logger.getLogger(B670Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    
}
